
<?

function intTo32BitNetworkOrder($integer) {
  return $machineOrderdBytes = pack("N", $integer);
}

function testSendInteger() {
    $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
    $result = socket_connect($socket, "localhost", 7766);

    socket_write($socket, pack("N", 69), 4);
//    $n = socket_read($socket, 4);
    socket_close($socket);
}


function printBytes($v)
{
  $v = print_r(intTo32BitNetworkOrder(256));
  for ($i = 0; $i < 4; $i++) {
    print($v % 256);
    $v /= 256;
  }
}

  testSendInteger();
  //printf(256);
  $x = unpack("N", intTo32BitNetworkOrder(256));
  print_r($x);
?>


